<template>
	<view class="box">
		<image src="/static/images/blank/blankH5.png" mode=""></image>
		<text @click="baocun">保存二维码到相册</text>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			};
		},
		onBackPress(options) {
			if (options.from === 'navigateBack') {
				return false
			}
			this.back();
			return true
		},
		onLoad() {
			uni.showToast({
				icon:"success",
				title:"充值成功"
			})
		},
		methods:{
			back() {
				uni.navigateBack({
					delta:3
				})
			},
			baocun() {
				//保存图片至相册
				uni.saveImageToPhotosAlbum({
					filePath: '/static/images/blank/blankH5.png',
					success: () => {
						uni.showToast({
							title: "保存成功",
							icon: "none"
						});
						setTimeout(() => {
							var pages = getCurrentPages()
							uni.navigateBack({
								delta:3
							})
						}, 1000)
			
					},
					fail: () => {
						uni.showToast({
							title: "保存失败!",
							icon: "none"
						});
						setTimeout(() => {
							var pages = getCurrentPages()
							uni.navigateBack({
								delta:3
							})
						}, 1000)
					}
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
.box{
	height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	image{
		width: 700rpx;
		height: 888rpx;
	}
	text{
		height: 100rpx;
		line-height: 100rpx;
		padding: 10rpx 30rpx;
		border-radius: 20rpx;
		background-color:#004363;
		color: #fff;
	}
}
</style>
